Telegram Group & Telegram Channel
Converts a hexadecimal color code to a tuple of integers corresponding to its RGB components.

Use a list comprehension in combination with int() and list slice notation to get the RGB components from the hexadecimal string.

Use tuple() to convert the resulting list to a tuple.

Code
:

def hex_to_rgb(hex):
return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4))

EXAMPLE

hex_to_rgb('FFA501')

Output:
(255, 165, 1)

Share and Support
@Python_Codes



tg-me.com/python_codes/149
Create:
Last Update:

Converts a hexadecimal color code to a tuple of integers corresponding to its RGB components.

Use a list comprehension in combination with int() and list slice notation to get the RGB components from the hexadecimal string.

Use tuple() to convert the resulting list to a tuple.

Code
:

def hex_to_rgb(hex):
return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4))

EXAMPLE

hex_to_rgb('FFA501')

Output:
(255, 165, 1)

Share and Support
@Python_Codes

BY Python Codes


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python_codes/149

View MORE
Open in Telegram


Python Codes Telegram | DID YOU KNOW?

Date: |

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

Telegram auto-delete message, expiring invites, and more

elegram is updating its messaging app with options for auto-deleting messages, expiring invite links, and new unlimited groups, the company shared in a blog post. Much like Signal, Telegram received a burst of new users in the confusion over WhatsApp’s privacy policy and now the company is adopting features that were already part of its competitors’ apps, features which offer more security and privacy. Auto-deleting messages were already possible in Telegram’s encrypted Secret Chats, but this new update for iOS and Android adds the option to make messages disappear in any kind of chat. Auto-delete can be enabled inside of chats, and set to delete either 24 hours or seven days after messages are sent. Auto-delete won’t remove every message though; if a message was sent before the feature was turned on, it’ll stick around. Telegram’s competitors have had similar features: WhatsApp introduced a feature in 2020 and Signal has had disappearing messages since at least 2016.

Python Codes from it


Telegram Python Codes
FROM USA